﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;

namespace LiuYan.Base
{
    public class MD5
    {

        /// <summary>
        /// 返回16位加密后的字符串
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public string Md5Get16(string str)
        {
            string md5 = FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").Substring(0, 16);
            return md5;
        }
        /// <summary>
        /// 返回32位加密后的字符串
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public string Md5Get32(string str)
        {
            string md5 = FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5");
            return md5;
        }
    }
}
